import Request from '@utils/request';

const request = new Request('/api/customer/');

/**
 * 页面配置
 */
export const appPage = params => {
  return request.get(`App/Page`, params);
};

/**
 * 当前店铺
 */
export const appCurretApp = () => {
  return request.get(`App/CurretApp`);
};

/**
 * 我的信息
 */
export const userGetInfo = clear => {
  return Promise.singleCache('userInfo', () => request.get(`User/GetInfo`), 3600, clear);
};

/**
 * 更新信息
 */
export const userUpdateUserInfo = body => {
  return request.post(`User/UpdateUserInfo`, body);
};

/**
 * 邀请
 */
export const userBindInvite = id => {
  return request.post(`User/BindInvite`, { id });
};

/**
 * 绑定手机号
 */
export const userBindMobile = body => {
  return request.post(`User/BindMobile`, body);
};

/**
 * 我的团队
 */
export const userTeamList = body => {
  return request.get(`User/TeamList`, body);
};

/**
 * 我的邀请
 */
export const userInviteList = body => {
  return request.get(`User/InviteList`, body);
};

/**
 * 平台登录
 */
export const userLoginByPlatform = body => {
  return request.post(`User/LoginByPlatform`, body);
};

/**
 * 列表
 */
export const userAddressGetList = () => {
  return request.get(`User/Address/GetList`);
};

/**
 * 获取默认
 */
export const userAddressDefault = () => {
  return request.get(`User/Address/Default`);
};

export const userAddressSetDefault = body => {
  return request.post(`User/Address/SetDefault`, body);
};

/**
 * 查询
 */
export const userLevelMap = params => {
  return request.get(`User/Level/Map`, params);
};

/**
 *
 */
export const userAddressSave = body => {
  return request.post(`User/Address/Save`, body);
};

/**
 *
 */
export const userAddressDelete = body => {
  return request.post(`User/Address/Delete`, body);
};
